package com.wu.llpsw.item.wuyao;

import com.wu.llpsw.networking.ModMessage;
import com.wu.llpsw.networking.packet.backYuanLiMaxPacket;
import com.wu.llpsw.networking.packet.backYuanLiNowPacket;
import com.wu.llpsw.yuanli.energy.yuanliManager;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;

//元米
public class yuan_mi extends Item {

    private int myAdd;
    public yuan_mi(Properties p_41383_,int my) {
        super(p_41383_.food(food));
        myAdd=my;
    }

    private static final FoodProperties food = (
            new FoodProperties.Builder())
            .nutrition(0)
            .saturationMod(0.0F)
            .fast()
            .build();

    //吃完给经验
    @Override
    public ItemStack finishUsingItem(ItemStack itemStack, Level world, LivingEntity entity) {
        if(entity instanceof Player){
            ((Player) entity).giveExperiencePoints(myAdd);

        }
        return super.finishUsingItem(itemStack, world, entity);
    }
}
